<%@page import="java.util.Date"%>
<%@page import="javax.xml.crypto.Data"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="../language.jsp" %>
    <%
    response.setHeader("Cache-Control","no-store");
    response.setHeader("Pragrma","no-cache");
    response.setDateHeader("Expires",0);
    
    if(session.getAttribute("password2")==null){
    	response.sendRedirect( "login2.jsp?pageUrl=user/xpTree.jsp");
    	return;
    }
    
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Insert title here</title>
<link rel="shortcut icon" href="../index/favicon.png" />
<link href="../skin/skin1/css/subPage.css" rel="stylesheet">
<link rel="stylesheet" href="css/sub_page_main_style.css" />
</head>
<body>
<body style="background:#fff;">
<div class="account">
	<div class="top"><fmt:message key="i18n.yewuManage"/> &gt; <fmt:message key="i18n.teamTreePicture"/></div>
	<!-- <div class="left"></div> -->
    <div class="right" style="margin: 0px;">
      <%-- <h4 style="color: black;">
      	<fmt:message key="i18n.teamTreePicture" />
		<img class="imgs" src="<%=request.getContextPath() %>/images/officialMember.gif" />
		<fmt:message key="i18n.jihuoUser"/>
		<img class="imgs" src="<%=request.getContextPath() %>/images/unofficialMember.gif" />
		<fmt:message key="i18n.unJihuoUser"/>
      </h4> --%>
    	<div style="padding: 10px;">
			<div id="xp_tree"></div>
		</div>
    </div>
</div>
<script type="text/javascript" src="../scripts/jquery/jquery-1.4.2.min.js"></script>
<script src="../scripts/jquery/easyui/jquery.easyui.min.js"></script>
<script src="../scripts/jstree/js/lib/jquery.cookie.js"></script>
<script src="../scripts/jstree/js/lib/jquery.hotkeys.js"></script>
<script src="../scripts/jstree/js/jquery.jstree.js"></script>
<script src="../scripts/jstree/js/rewritejstree.js"></script>

<script>

function viewUserInfo(userNo){
	$.post('user!findUserInfo.action','userDTO.userNo='+userNo,function(data){
		var msg='User information(用户信息)：\n'+
		'Member number(会员编号):'+data.userNo+'\n'+
		'Member name(会员昵称):'+data.userName+'\n'+
		'Real name(真实姓名):'+data.fullName+'\n'+
		'Card ID(身份证):'+data.cardId+'\n'+
		'Contact QQ(联系QQ号):'+data.qqNumber+'\n'+
		'Telephone number(电话号码):'+data.phone+'\n'
		'The remitting bank(汇款银行):'+data.bank+'-'+data.bankInfo+'\n'+
		'Bank account name(银行戶名):'+data.openBankName+'\n'+
		'Bank account(银行账号):'+data.bankNumber+'\n'+
		'Pay treasure(支 付 宝):'+data.alipayNumber+'\n'+
		'TenPay(财 付 通):'+data.tenpayNumber+'\n'+
		'The membership grade(会员级别):'+data.level+'级\n'
		alert(msg);
	});
}
function viewXPTree(loginName){
	var lang = "${cookie['language'].value?'zh_CN':cookie['language'].value}";
	 $('#xp_tree').html('');
	 $('#xp_tree').jstree({
			json_data: {
				ajax: {
				  type:"post",
				  url : "registerUser!findXPTree.action?lang="+'zh_CN',
				  data:function(n){
			    	  return {'registerUserDTO.loginName':n.attr ? n.attr("loginName").replace("node_",""):loginName,"dtype":n.attr ? "sub":"all"};//types is in action
			      },
                  dataType: 'json',
                  cache:false
			 	}
			},
		"plugins" : [ "themes", "json_data", "ui", "crrm","dnd", "search", "types", "hotkeys"]
	})
	//.bind('loaded.jstree', function(e,data){data.inst.open_all(1);})
	.bind("select_node.jstree", function(e,data){
		if(data.rslt.obj.attr('newReg')=='newReg'){
			//alert(data.rslt.obj.attr('topuser')+"--"+data.rslt.obj.attr('businessDirection'));
			window.location='reg.jsp?contactNo='+data.rslt.obj.attr('contactNo')+'&registerLocation='+data.rslt.obj.attr('registerLocation');
		}else{
			//viewUserInfo(data.rslt.obj.attr('userNo'));
		}
	 });
}


$(function(){
	viewXPTree('${session.loginName}');
});

</script>


</body>
</html>